home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Networking / OTStreamLogViewer / IC Libraries / ICMiscSubs.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  5.6 KB  |  152 lines  |  [TEXT/CWIE]

  1. /*    This file is part of the Internet Configuration system and is placed in the public domain for the benefit of all.
  2.  
  3.     This file holds all those miscellaneous little functions that are basically wrappers
  4.     around existing OS functionality.
  5. */
  6.  
  7. #import <Lists.h>
  8. #import <AppleEvents.h>
  9.  
  10. /* ***** QuickDraw Stuff ***** */
  11.  
  12. extern pascal void DrawIcon(SInt16 resourceID, const Rect iconRect, Boolean drawHighlighted);
  13.     /* This routine draws in icon from the resources specified by resourceID.
  14.         If the System 7 icon utilities are available, it uses the icon family
  15.         resources 'icl8', and draws using the icon utilities.  If they're not available,
  16.         it uses the 'ICN#' resource and draws using PlotIcon.
  17.     */
  18.  
  19. extern pascal void MagicMarkerMode(void);
  20.     /* This routine sets the HiliteMode low memory global such that the
  21.         next invert operation is done using the user specified highlight colour.
  22.         If Colour QuickDraw isn't available, it does nothing.
  23.     */
  24.  
  25. /* ***** Event Manager Stuff ***** */
  26.  
  27. extern pascal Boolean DirtyKey(char typedChar);
  28.     /* This function returns true if the given character will cause a Text
  29.         Edit field to become dirty, ie it's a character that will go into
  30.         the field rather than move the insertion point.
  31.     */
  32.     
  33. extern pascal Boolean IsKeyDown(SInt16 keyCode);
  34.     /* Returns true if the given virtual key is down. */
  35.  
  36. /* ***** Window Manager Stuff ***** */
  37.  
  38. /* EnterWindow, ExitWindow and the SavedWindowState type are used to implement
  39.     a standard mechanism for saving and restoring window information.  You call
  40.     EnterWindow when you want to work on a window.  This sets up the parameters
  41.     you need and saves the old parameters in the SavedWindowState variable.
  42.     You then call ExitWindow to restore that state.
  43. */
  44.  
  45. struct SavedWindowInfo {
  46.     GrafPtr oldPort;
  47.     GrafPtr thisPort;
  48.     SInt16 font;
  49.     SInt16 size;
  50.     SInt16 face;
  51. };
  52. typedef struct SavedWindowInfo SavedWindowInfo;
  53.  
  54. extern pascal void EnterWindow(WindowPtr window, SInt16 font, SInt16 size, Style face,
  55.                                             SavedWindowInfo *saved);
  56.     /* Set thePort to window and establish the various window state parameters.
  57.         Save the old parameters in saved.
  58.     */
  59.     
  60. extern pascal void ExitWindow(const SavedWindowInfo saved);
  61.     /* Recover the window parameters from saved. */
  62.  
  63. extern pascal RgnHandle GetWindowContentRegion(WindowPtr theWindow);
  64.     /* Returns the window's content region. This is the region currently
  65.         being used, not a copy.  Do not munge it!
  66.     */
  67.     
  68. extern pascal RgnHandle GetWindowStructureRegion(WindowPtr theWindow);
  69.     /* Returns the window's structure region. This is the region currently
  70.         being used, not a copy.  Do not munge it!
  71.     */
  72.  
  73. extern pascal Boolean TitleBarOnScreen(WindowPtr theWindow);
  74.     /* Returns true if the window's title bar is on the screen.
  75.         Note that this routine only works if the window is visible,
  76.         ie you have called ShowWindow on it.  The standard mechanism
  77.         for using this routine is to ShowWindow the window, then
  78.         call TitleBarOnScreen.  If it returns true, everything is cool.
  79.         Otherwise the window is completely off the screen, so you can
  80.         move it back on without causing visible effects.
  81.     */
  82.     
  83. extern pascal void GetWindowRect(WindowPtr theWindow, Rect *windowRect);
  84.     /* This routine sets windowRect to the global co-ordinates of 
  85.         the position of the window.  It's typically used for saving window
  86.         state.
  87.     */
  88.     
  89. /* ***** Menu Manager Stuff ***** */
  90.  
  91. extern pascal void SetMenuItemEnable(MenuHandle menuH, SInt16 item, Boolean enable);
  92.     /* Enable the item in the MenuHandle if enable is set, disable it otherwise.
  93.         You've gotta wonder why this isn't in the operating system!
  94.     */
  95.     
  96. extern pascal Boolean FindMenuItem(MenuHandle menuH, Str255 itemTextToSearchFor, 
  97.                                             SInt16 *indexOfItemFound);
  98.     /* This routine searches through the Menu Handle looking for
  99.         itemTextToSearchFor.  If it finds it, it returns true and sets
  100.         indexOfItemFound to the position of the matching menu item.
  101.     */
  102.  
  103. /* ***** List Manager Stuff ***** */
  104.  
  105. /* All of these List Manager routines are really targetted at one dimensional
  106.     vertical lists.  They don't work well for two dimensional or horizontal
  107.     lists.
  108. */
  109.  
  110. extern pascal void InitListManagerMiscSubs(void);
  111.     /* The LDoKey function requires a bunch of global state to implement
  112.         it's "select by typing" function. This routine initialises that
  113.         information.
  114.     */
  115.  
  116. extern pascal void LSetNoSelection(ListHandle listH);
  117.     /* This routine clears any selection in the list. */
  118.  
  119. extern pascal LSelectAll(ListHandle listH);
  120.     /* This routine selects the entire contents of the list. */
  121.  
  122. extern pascal void LSetSingleSelection(ListHandle listH, SInt16 row);
  123.     /* This routine selects the single cell (0, row) in the list. */
  124.  
  125. /* The LDoKey routine takes a procedural parameter that is uses to fetch
  126.     the text associated with an item in the list so that it can implement
  127.     its "select by typing" function.
  128. */
  129.  
  130. typedef pascal void (*GetListCellTextProcType)(ListHandle listH, Cell listCell, Str255 cellText);
  131.  
  132. extern pascal void LDoKey(ListHandle listH, EventRecord *event, GetListCellTextProcType getCellText);
  133.     /* This routine processes a key event associated with a list, including
  134.         "select by typing".  You can disable this function by passing nil to
  135.         getCellText.
  136.     */
  137.  
  138. extern pascal SInt16 LSelectedLine(ListHandle lh);
  139.     /* This function returns the vertical position of the first selected
  140.         cell in the list, or -1 if there is no selected cell.
  141.     */
  142.  
  143. extern pascal Boolean LIsEmpty (ListHandle lh);
  144.     /* This function returns true if the list is empty. */
  145.  
  146. /* ***** Truly Misc Stuff ***** */
  147.  
  148. extern pascal OSStatus AEGotRequiredParams(const AppleEvent *theAppleEvent);
  149.     /* Returns no error if you've extracted all of the required
  150.         parameters out of the AppleEvent.
  151.     */
  152.